# -*- coding: utf-8 -*-
# @Time    : 2018/8/16 11:08
# @Author  : 聂家利
# @Email   : 1073438012@qq.com
# @File    : get_host_ip.py
# @Software: PyCharm

import socket


def get_host_ip():
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.connect(('8.8.8.8', 80))
        ip = s.getsockname()[0]
    finally:
        s.close()

    return ip